<?php

  //
  // Memorii Web
  // script/edit_word_reading.php
  //
  // 
  //
  
  session_start();
  
  require_once('../const.php');
  require_once('../db/db.php');
  
  $word_id = '0';
  if( isset($_SESSION['current_word_id'])) {
  	$word_id = $_SESSION['current_word_id'];
  }
  $new_reading = '';
  if( isset($_POST['new_reading'])) {
  	$new_reading = $_POST['new_reading'];
  }
  
  $db_connection = db_connect();
  db_edit_word_reading($db_connection, $word_id, $new_reading);
  db_disconnect($db_connection);

  echo '<div class="msg">Reading edited.</div>';
  
  include('../../content/word.php');
?>